#include <iostream>
using namespace std;

class A {
public:
	A (int data) {
		cout << "A的构造函数" << endl;
		m_data = data;
	}
	int m_data;
};

class B {
public:
	//:m_a(1234), 指明成员子对象的初始化方式
	B (void):m_a(1234) {
		cout << "B的构造函数" << endl;
	}
	A m_a;
};

int main (void)
{
	//此处如果B类中没有无参构造函数则直接报错
	B b;
	cout << b.m_a.m_data << endl;
	return 0;
}
